#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

struct student {
	char name[64];
	int id;
	int math;
	int physics;
};

typedef struct student student;

int main() {
	student list[64];
	int m_size = 0;
	int p_size = 0;
	int t_i = 0;
	while (scanf("%s %d %d %d", &list[t_i].name, &list[t_i].id, &list[t_i].physics, &list[t_i].math) != EOF) {
		if (list[t_i].physics >= 0) {
			p_size++;
		}
		if (list[t_i].math>=0) {
			m_size++;
		}

		t_i++;
	}

	{
	int hg = 0;
	int sum = 0;
	for (int i = 0; i < t_i; i++) {
		if (list[i].physics <= 0) {
			continue;
		}

		if (list[i].physics > hg) {
			hg = list[i].physics;
		}
		sum += list[i].physics;
	}
	int g1_c = 0;
	int g2_c = 0;
	int g3_c = 0;
	int g4_c = 0;
	int g5_c = 0;
	for (int i = 0; i < t_i; i++) {
		if (list[i].physics <= 0) {
			continue;
		}
		if (90 <= list[i].physics) {
			g1_c++;
		} else if (80 <= list[i].physics) {
			g2_c++;
		} else if (70 <= list[i].physics) {
			g3_c++;
		} else if (60 <= list[i].physics) {
			g4_c++;
		} else {
			g5_c++;
		}
	}
	int r = round(((double)sum) / ((double)p_size));
	printf("physics:%d(%.2f);%d(%.2f);%d(%.2f);%d(%.2f);%d(%.2f);%d;\n",
		g1_c, ((float)g1_c) / ((float)p_size),
		g2_c, ((float)g2_c) / ((float)p_size),
		g3_c, ((float)g3_c) / ((float)p_size),
		g4_c, ((float)g4_c) / ((float)p_size),
		g5_c, ((float)g5_c) / ((float)p_size),
		r
	);


	for (int i = 0; i < t_i; i++) {
		if (list[i].physics == hg) {
			printf("physics:%s;%d;%d;\n", list[i].name, list[i].id, list[i].physics);
		}
	}

	}

	{
	int hg = 0;
	int sum = 0;
	for (int i = 0; i < t_i; i++) {
		if (list[i].math <= 0) {
			continue;
		}
		if (list[i].math > hg) {
			hg = list[i].math;
		}
		sum += list[i].math;
	}
	int g1_c = 0;
	int g2_c = 0;
	int g3_c = 0;
	int g4_c = 0;
	int g5_c = 0;
	for (int i = 0; i < t_i; i++) {
		if (list[i].math <= 0) {
			continue;
		}
		if (90 <= list[i].math) {
			g1_c++;
		} else if (80 <= list[i].math) {
			g2_c++;
		} else if (70 <= list[i].math) {
			g3_c++;
		} else if (60 <= list[i].math) {
			g4_c++;
		} else {
			g5_c++;
		}
	}
	int r = round(((double)sum) / ((double)m_size));
	printf("math:%d(%.2f);%d(%.2f);%d(%.2f);%d(%.2f);%d(%.2f);%d;\n",
		g1_c, ((float)g1_c) / ((float)m_size),
		g2_c, ((float)g2_c) / ((float)m_size),
		g3_c, ((float)g3_c) / ((float)m_size),
		g4_c, ((float)g4_c) / ((float)m_size),
		g5_c, ((float)g5_c) / ((float)m_size),
		r
	);


	for (int i = 0; i < t_i; i++) {
		if (list[i].math == hg) {
			printf("math:%s;%d;%d;\n", list[i].name, list[i].id, list[i].math);
		}
	}

	}
}